<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html class="loginHtml">
<head>
    <meta charset="utf-8">
    <title>在线写作系统登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/static/css/login.css" media="all"/>
</head>
<body>
<div id="bg-body"></div>
<div class="login">
    <h1>在线写作系统登录</h1>
    <form class="layui-form" action="/user/login" method="POST">
        <div class="layui-form-item">
            <input class="layui-input" name="username"  placeholder="请输入用户名" lay-verify="required"
                   type="text"
                   autocomplete="off">
        </div>
        <div class="layui-form-item">
            <input class="layui-input" name="password"  placeholder="请输入密码" lay-verify="required"
                   type="password" autocomplete="off">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn fa-registered" lay-submit="" lay-filter="login"
                    style="margin-left: 90px; width: 74px">登录</button>
        </div>
    </form>
</div>
</body>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        form.on('submit(login)', function (data) {
            var loadIndex = layer.load(2, {
                shade: [0.3, '#333']
            });
            $.post(data.form.action, data.field, function (res) {
                layer.close(loadIndex);
                if (res.code==="1") {
                    window.location.href = "/index";
                } else {
                    layer.msg(res.message);
                }
            });
            return false;
        });
    })
</script>
</html>
